//
//  BaseTextField.m
//  QuXiang
//
//  Created by Duncan on 2020/6/22.
//  Copyright © 2020 NanHuaiZi. All rights reserved.
//

#import "BaseTextField.h"

@implementation BaseTextField

- (instancetype)init {
    self = [super init];
    if (self) {
        self.background = [UIImage kj_imageWithColor:k_Color_F3F3FB size:CGSizeMake(1, 1)];
        
        self.font = kAdaptedMediumFontSize(15);
        self.autocapitalizationType = UITextAutocapitalizationTypeNone; // 关闭首字母大写
        self.autocorrectionType = UITextAutocorrectionTypeNo; // 系统自动联想功能
        self.spellCheckingType = UITextSpellCheckingTypeNo; // 拼写检查
        self.returnKeyType = UIReturnKeyDone;
        [self addPaddingLeft:kFragmemtFloat(15)];
        
        self.layer.cornerRadius = kFragmemtFloat(24);
        self.layer.masksToBounds = YES;
    }
    return self;
}

- (void)addPaddingLeft:(CGFloat)padding {
    UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, padding, 1)];
    self.leftView = paddingView;
    self.leftViewMode = UITextFieldViewModeAlways;
}

@end
